<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* .father{
            width: 200px;
            height: 200px;
            border: 1px solid red;
            position: relative;
        }
        .son{
            width: 50px;
            height: 50px;
            position: absolute;
            left: 50%;
            top: 50%;
            background-color: gold;
            transform: translate(-50%,-50%);

        } */

        /* .father {
            width: 200px;
            height: 200px;
            display: flex;
            border: 1px solid red;
            justify-content: center;
            align-items: center;
        }

        .son {
            height: 100px;
            width: 100px;
            background-color: gold;
        } */

        /* .father {
            width: 200px;
            height: 200px;
            display: grid;
            border: 1px solid red;
        }

        .son {
            height: 100px;
            width: 100px;
            background-color: gold;
            margin: auto;
        } */


        /* .box {
            width: 200px;
            height: 200px;
            border: 1px solid red;
            position: relative;
        }

        .children-box {
            position: absolute;
            background: yellow;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
        } */


        /* .box {
            width: 200px;
            height: 200px;
            border: 1px solid red;
            display: flex;
            justify-content: center;
            align-items: center;
        } */

        /* .box {
            width: 200px;
            height: 200px;
            display: grid;
            border: 1px solid red;
        }

        .children-box {
            margin: auto;
        } */
    </style>
</head>

<body>
    <!-- 多种方式实现水平垂直居中，定高与不定高 -->
    <!--  定高 -->
    <!-- <div class="father">
        <div class="son"></div>
    </div> -->


    <!-- 定高与不定高其实差不多方法 -->
    <!-- 不定高 -->
    <div class="box">
        <div class="children-box">111111</div>
    </div>
</body>

</html>